\hypertarget{classdev_1_1net_1_1_reactor}{}\section{dev\+:\+:net\+:\+:Reactor Class Reference}
\label{classdev_1_1net_1_1_reactor}\index{dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}}


网络反应器  




{\ttfamily \#include $<$Reactor.\+hpp$>$}

Inheritance diagram for dev\+:\+:net\+:\+:Reactor\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classdev_1_1net_1_1_reactor}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classdev_1_1net_1_1_reactor_a4b7b6ab75371fa1b201a413ea6274c38}{}enum {\bfseries Event\+Type} \{ \\*
{\bfseries N\+O\+N\+E}, 
{\bfseries R\+E\+A\+D} = 0x1, 
{\bfseries W\+R\+I\+T\+E} = 0x2, 
{\bfseries E\+X\+C\+E\+P} = 0x4, 
\\*
{\bfseries R\+D\+W\+R} = R\+E\+A\+D $\vert$ W\+R\+I\+T\+E, 
{\bfseries R\+D\+E\+X} = R\+E\+A\+D $\vert$ E\+X\+C\+E\+P, 
{\bfseries W\+R\+E\+X} = W\+R\+I\+T\+E $\vert$ E\+X\+C\+E\+P, 
{\bfseries A\+L\+L} = R\+D\+W\+R $\vert$ E\+X\+C\+E\+P
 \}\label{classdev_1_1net_1_1_reactor_a4b7b6ab75371fa1b201a413ea6274c38}

\item 
\hypertarget{classdev_1_1net_1_1_reactor_a85fa70df32731c763a16d5fae0013de5}{}enum {\bfseries Status} \{ {\bfseries R\+E\+A\+D\+Y}, 
{\bfseries R\+U\+N\+N\+I\+N\+G}, 
{\bfseries E\+X\+I\+T}
 \}\label{classdev_1_1net_1_1_reactor_a85fa70df32731c763a16d5fae0013de5}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual bool \hyperlink{classdev_1_1net_1_1_reactor_a53939a07465e8c772b63fb8d31a313ec}{add\+Socket} (\hyperlink{classdev_1_1net_1_1_socket}{Socket} $\ast$sock, Event\+Type events, \hyperlink{classdev_1_1net_1_1_socket_event_handler}{Socket\+Event\+Handler} $\ast$handler)=0
\begin{DoxyCompactList}\small\item\em 添加一个套接字到反应器 \end{DoxyCompactList}\item 
virtual bool \hyperlink{classdev_1_1net_1_1_reactor_a032df9cb5073c0bbc387e8206c6a8507}{remove\+Socket} (\hyperlink{classdev_1_1net_1_1_socket}{Socket} $\ast$sock)=0
\begin{DoxyCompactList}\small\item\em 移除套接字 \end{DoxyCompactList}\item 
virtual void \hyperlink{classdev_1_1net_1_1_reactor_a82d3315e9f4a00eff67ea868ab7e0b6b}{tick} (int timeout=0)=0
\begin{DoxyCompactList}\small\item\em 执行一次网络事件 \end{DoxyCompactList}\item 
\hypertarget{classdev_1_1net_1_1_reactor_a69c9596ef5f394df5824f753e7358685}{}virtual void \hyperlink{classdev_1_1net_1_1_reactor_a69c9596ef5f394df5824f753e7358685}{clean} (void)=0\label{classdev_1_1net_1_1_reactor_a69c9596ef5f394df5824f753e7358685}

\begin{DoxyCompactList}\small\item\em 清理反应器 \end{DoxyCompactList}\item 
Status \hyperlink{classdev_1_1net_1_1_reactor_a5e00626edea76a086d1db104345ee4ad}{get\+Status} (void) const 
\begin{DoxyCompactList}\small\item\em 获取反应器状态 \end{DoxyCompactList}\item 
void \hyperlink{classdev_1_1net_1_1_reactor_a9ddff658f29b6d51a9f06c96a8176766}{set\+Status} (Status status)
\begin{DoxyCompactList}\small\item\em 设置反应器状态 \end{DoxyCompactList}\item 
int \hyperlink{classdev_1_1net_1_1_reactor_a95cff3841403c0c59990a1969e6e62fa}{get\+Heart\+Beat\+Time} (void) const 
\begin{DoxyCompactList}\small\item\em 获取反应器心跳时间 \end{DoxyCompactList}\item 
void \hyperlink{classdev_1_1net_1_1_reactor_aba6f59dcdb9f1d73f11e022ef6af502b}{set\+Heart\+Beat\+Time} (int time)
\begin{DoxyCompactList}\small\item\em 设置反应器心跳时间 \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classdev_1_1net_1_1_reactor_a6e50a384a756df66536ea8ece6f49e96}{}Status {\bfseries status\+\_\+}\label{classdev_1_1net_1_1_reactor_a6e50a384a756df66536ea8ece6f49e96}

\item 
\hypertarget{classdev_1_1net_1_1_reactor_a9c320521a84ab99434b4b9e48af5f5da}{}int {\bfseries heart\+Beat\+Time\+\_\+}\label{classdev_1_1net_1_1_reactor_a9c320521a84ab99434b4b9e48af5f5da}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
网络反应器 

\subsection{Member Function Documentation}
\hypertarget{classdev_1_1net_1_1_reactor_a53939a07465e8c772b63fb8d31a313ec}{}\index{dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}!add\+Socket@{add\+Socket}}
\index{add\+Socket@{add\+Socket}!dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}}
\subsubsection[{add\+Socket(\+Socket $\ast$sock, Event\+Type events, Socket\+Event\+Handler $\ast$handler)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual bool dev\+::net\+::\+Reactor\+::add\+Socket (
\begin{DoxyParamCaption}
\item[{{\bf Socket} $\ast$}]{sock, }
\item[{Event\+Type}]{events, }
\item[{{\bf Socket\+Event\+Handler} $\ast$}]{handler}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classdev_1_1net_1_1_reactor_a53939a07465e8c772b63fb8d31a313ec}


添加一个套接字到反应器 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字 \\
\hline
{\em events} & 注册的事件 \\
\hline
{\em handelr} & 事件处理器 \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classdev_1_1net_1_1detail_1_1_select_reactor_a4a6e88b02454504628332d69e29590b7}{dev\+::net\+::detail\+::\+Select\+Reactor}, and \hyperlink{classdev_1_1net_1_1detail_1_1_e_poll_reactor_a17ce65f9c19bf7d3cf577d3fbebef2ef}{dev\+::net\+::detail\+::\+E\+Poll\+Reactor}.

\hypertarget{classdev_1_1net_1_1_reactor_a95cff3841403c0c59990a1969e6e62fa}{}\index{dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}!get\+Heart\+Beat\+Time@{get\+Heart\+Beat\+Time}}
\index{get\+Heart\+Beat\+Time@{get\+Heart\+Beat\+Time}!dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}}
\subsubsection[{get\+Heart\+Beat\+Time(void) const }]{\setlength{\rightskip}{0pt plus 5cm}int dev\+::net\+::\+Reactor\+::get\+Heart\+Beat\+Time (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_reactor_a95cff3841403c0c59990a1969e6e62fa}


获取反应器心跳时间 

\begin{DoxyReturn}{Returns}
int 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_reactor_a5e00626edea76a086d1db104345ee4ad}{}\index{dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}!get\+Status@{get\+Status}}
\index{get\+Status@{get\+Status}!dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}}
\subsubsection[{get\+Status(void) const }]{\setlength{\rightskip}{0pt plus 5cm}Status dev\+::net\+::\+Reactor\+::get\+Status (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_reactor_a5e00626edea76a086d1db104345ee4ad}


获取反应器状态 

\begin{DoxyReturn}{Returns}
Status 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_reactor_a032df9cb5073c0bbc387e8206c6a8507}{}\index{dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}!remove\+Socket@{remove\+Socket}}
\index{remove\+Socket@{remove\+Socket}!dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}}
\subsubsection[{remove\+Socket(\+Socket $\ast$sock)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual bool dev\+::net\+::\+Reactor\+::remove\+Socket (
\begin{DoxyParamCaption}
\item[{{\bf Socket} $\ast$}]{sock}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classdev_1_1net_1_1_reactor_a032df9cb5073c0bbc387e8206c6a8507}


移除套接字 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字 \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classdev_1_1net_1_1detail_1_1_select_reactor_a754ba1aacd7171e7f551a5e92fca23bb}{dev\+::net\+::detail\+::\+Select\+Reactor}, and \hyperlink{classdev_1_1net_1_1detail_1_1_e_poll_reactor_a89aee7fbc4facb84614d1d6bd35b14df}{dev\+::net\+::detail\+::\+E\+Poll\+Reactor}.

\hypertarget{classdev_1_1net_1_1_reactor_aba6f59dcdb9f1d73f11e022ef6af502b}{}\index{dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}!set\+Heart\+Beat\+Time@{set\+Heart\+Beat\+Time}}
\index{set\+Heart\+Beat\+Time@{set\+Heart\+Beat\+Time}!dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}}
\subsubsection[{set\+Heart\+Beat\+Time(int time)}]{\setlength{\rightskip}{0pt plus 5cm}void dev\+::net\+::\+Reactor\+::set\+Heart\+Beat\+Time (
\begin{DoxyParamCaption}
\item[{int}]{time}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_reactor_aba6f59dcdb9f1d73f11e022ef6af502b}


设置反应器心跳时间 

\begin{DoxyReturn}{Returns}
int 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_reactor_a9ddff658f29b6d51a9f06c96a8176766}{}\index{dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}!set\+Status@{set\+Status}}
\index{set\+Status@{set\+Status}!dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}}
\subsubsection[{set\+Status(\+Status status)}]{\setlength{\rightskip}{0pt plus 5cm}void dev\+::net\+::\+Reactor\+::set\+Status (
\begin{DoxyParamCaption}
\item[{Status}]{status}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_reactor_a9ddff658f29b6d51a9f06c96a8176766}


设置反应器状态 

\begin{DoxyReturn}{Returns}
Status 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_reactor_a82d3315e9f4a00eff67ea868ab7e0b6b}{}\index{dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}!tick@{tick}}
\index{tick@{tick}!dev\+::net\+::\+Reactor@{dev\+::net\+::\+Reactor}}
\subsubsection[{tick(int timeout=0)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual void dev\+::net\+::\+Reactor\+::tick (
\begin{DoxyParamCaption}
\item[{int}]{timeout = {\ttfamily 0}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classdev_1_1net_1_1_reactor_a82d3315e9f4a00eff67ea868ab7e0b6b}


执行一次网络事件 


\begin{DoxyParams}{Parameters}
{\em timeout} & 检查网络事件的超时时间 \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classdev_1_1net_1_1detail_1_1_select_reactor_a4f46d46b326a7a4f1a88c79032ace5ea}{dev\+::net\+::detail\+::\+Select\+Reactor}, and \hyperlink{classdev_1_1net_1_1detail_1_1_e_poll_reactor_a09b95e05048965654a029b529f74d8a0}{dev\+::net\+::detail\+::\+E\+Poll\+Reactor}.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
dev/dev/net/Reactor.\+hpp\end{DoxyCompactItemize}
